<template>
	<view class="">
		<u-navbar title="调查问卷" :autoBack="true" :placeholder="true"></u-navbar>

		<image src="https://wyc.jslhkj.cn/uploads/20231031/61fdba49dff841cde071dddabaed0a5e.jpg" mode=""
			class="bg-login"></image>

		<view class="yy-form">

			<view class="flex input-cell" v-for="item in reqList" key="index">
				<view class="input-label">{{item.name}}</view>
				<view class="input-box">
					<radio-group bindchange="radioChange" class="radio-list" v-for="items in ['是', '否']" v-key="item">
						<label class="weui-cell weui-check__label">

							<view class="weui-cell__hd">
								<radio :value="items == '是' ? item.checked : !item.checked"
									:checked="items == '是' ? item.checked : !item.checked" />
							</view>
							<view class="weui-cell__bd">{{items}}</view>
						</label>
					</radio-group>
				</view>
			</view>

		</view>

		<button @click="addyuyue" class="submit-btn">提交</button>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				uid: wx.getStorageSync('userId'),
				name: '',
				moblie: '',
				nickname: '',
				sex: '',
				birthtime: '',
				reqList: null,
			}
		},

		onLoad() {
			this.question();
		},

		methods: {
			async question() {
				let patams = {};
				let res = await this.$api.question(patams);
				console.log(res);

				let data = res.data;

				for (let item of data) {
					item.checked = true;
				}

				this.reqList = data;
			},
		},
	}
</script>

<style lang="scss" scoped>
	.bg-login {
		width: 100vw;
		height: 480rpx;
		// position: absolute;
		z-index: -100;
	}

	.submit-btn {
		background-color: #111;
		color: white;
		margin: 50rpx 20rpx 0 20rpx;
		border-radius: 50rpx;
	}

	.yy-form {
		background-color: white;
		padding-bottom: 20rpx;
	}

	.input-cell {
		height: 80rpx;
		line-height: 80rpx;
		padding: 0 20rpx;
		justify-content: space-between;
		margin-bottom: 20rpx;
		font-size: 28rpx;

	}

	.input {
		height: 80rpx;
		background-color: #eee;
		width: calc(100% - 20rpx);
		padding-left: 20rpx;
		border-radius: 10rpx;
	}

	.input-label {
		width: 300rpx;
		text-align: right;
		font-weight: 700;
	}

	.input-box {
		flex: 2;
		padding-left: 20rpx;
		display: flex;
	}

	.radio-list {
		display: flex;
	}

	.weui-check__label {
		display: flex;
	}
</style>